﻿using System;
using System.Drawing;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace WorldViewSolutions.ArcGISServer.SOE
{
    /// <summary>
    /// Used to convert stdole image to managed .net images.
    /// </summary>
	internal class AxHostConverter : AxHost
	{
        /// <summary>
        /// Initializes a new instance of the <see cref="T:System.ComponentModel.Component"/> class.
        /// </summary>
		private AxHostConverter() : base("") { }


        /// <summary>
        /// Images to picture disp.
        /// </summary>
        /// <param name="image">The image.</param>
        /// <returns></returns>
		static public stdole.IPictureDisp ImageToPictureDisp(Image image)
		{
			return (stdole.IPictureDisp)GetIPictureDispFromPicture(image);
		}


        /// <summary>
        /// Pictures the disp to image.
        /// </summary>
        /// <param name="pictureDisp">The picture disp.</param>
        /// <returns></returns>
		static public Image PictureDispToImage(stdole.IPictureDisp pictureDisp)
		{
			return GetPictureFromIPicture(pictureDisp);
		}

        /// <summary>
        /// Pictures the disp to image.
        /// </summary>
        /// <param name="picture">The picture.</param>
        /// <returns></returns>
		static public Image PictureDispToImage(stdole.IPicture picture)
		{
			return GetPictureFromIPicture(picture);
		}
	}

}
